package com.gitee.swsk33.mapstructdemo.dataobject;

import com.mybatisflex.annotation.*;
import lombok.Data;

import java.util.List;

@Data
@Table("figure")
public class FigureDO {

	/**
	 * 主键id
	 */
	@Id(keyType = KeyType.Auto)
	private Integer id;

	/**
	 * 角色名称
	 */
	private String name;

	/**
	 * 角色外号
	 */
	private String nickname;

	/**
	 * 角色类型
	 */
	private String type;

	/**
	 * 角色所属公会id
	 */
	private Integer guildId;

	/**
	 * 角色对应的专属武器
	 */
	@RelationOneToOne(selfField = "id", targetField = "figureId")
	private SpecialWeaponDO specialWeapon;

	/**
	 * 角色所属公会
	 */
	@RelationManyToOne(selfField = "guildId")
	private GuildDO guild;

	/**
	 * 角色拥有的武器
	 */
	@RelationOneToMany(targetField = "figureId")
	private List<WeaponDO> weapons;

	/**
	 * 角色参与的故事
	 */
	@RelationManyToMany(joinTable = "story_figure",
			selfField = "id", joinSelfColumn = "figure_id",
			targetField = "id", joinTargetColumn = "story_id")
	private List<StoryDO> stories;

}